home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Utilities / AmiBroker / broker.comment < prev    next >
Text File  |  1999-09-21  |  3KB  |  77 lines

  1. /* Project:       AmiBroker
  2. ** File:          macd.afl
  3. ** Title:         MACD Guru Commentary Example (English)
  4. ** Requirements:  AFL 1.1    (AmiBroker 2.91) or above
  5. ** Date:          Feb 9th, 1999
  6. ** Written by:    Tomasz Janeczko
  7. */ 
  8.  
  9. buy=cross( macd(), signal() );
  10. sell = cross( signal(), macd() );
  11.  
  12. "Review of " + fullname() + " (" + name() + ")" + "\nas of " + date();
  13.  
  14.  
  15. "\nCurrent Statistics\n";
  16. "Close: " + WriteVal(Close);
  17. "Change: " + WriteVal(Close - Ref( Close, -1 ) ) ;
  18. "MACD Value: " + WriteVal(MACD());
  19. "Signal Line: " + WriteVal(SIGNAL());
  20.  
  21. "\nThe MACD can provide buy/sell indications in three ways, signal line crossovers, overbought/oversold conditions, and divergences.\n";
  22.  
  23. "Crossovers:\n";
  24. "Currently the MACD is "+
  25. writeif(macd() > signal(),"bullish","bearish")+
  26. " since it is trading "+
  27. writeif(macd() > signal(),"above","below")+
  28. " its signal line.";
  29.  
  30.  
  31. "The MACD crossed "+
  32. writeif(macd() > signal(),"above","below")+
  33. " its signal line "+
  34. writeval( min( barssince( cross( macd(), signal() )), barssince( cross( signal(), macd()))), 0.0)+
  35. " period(s) ago.";
  36.  
  37. bars=lastvalue(min( barssince( cross( macd(), signal() )), barssince( cross( signal(), macd())) ));
  38.  
  39. prevclose=ref(Close,-bars);
  40.  
  41. "Since the MACD crossed its moving average, "+
  42. name()+"'s price has "+
  43. writeif(close>prevclose,"increased ","decreased ")+
  44. writeval(100*(close-prevclose)/prevclose) + "%";
  45.  
  46. "And has ranged from a high of "+
  47. writeval(HHV(High,bars+1),6.3)+
  48. " to a low of "+
  49. writeval(LLV(Low,bars+1),6.3);
  50.  
  51. "\nOverbought/Oversold\n";
  52. Osc = OscP( 12, 26 );
  53. Osc1 = Ref( Osc, -1 );
  54. Osc5 = Ref( Osc, -5 );
  55.  
  56. writeif( Osc <= -3 AND ( Osc - Osc5 ) == -Sum( Abs( Osc - Osc1 ), 5 ),
  57. "The MACD is in an oversold range. Prices may continue to move lower for some time.  Wait for prices to move higher before considering any long positions.", 
  58. writeif( Osc >= 3 AND ( Osc - Osc5 ) ==  Sum( Abs( Osc - Osc1 ), 5 ), 
  59. "The MACD is in an overbought range.  Prices may continue to move higher for some time.  Wait for prices to move lower before considering any short positions.", 
  60. "The MACD is not in an Overbought/Oversold range."));
  61.  
  62. "\nDivergence\n";
  63. temp = Trough(LOW, 2, 1) < 0.96 * Ref( Trough(LOW, 2, 1), -1) AND ValueWhen( Trough(LOW, 2, 1) != Ref( Trough(LOW, 2, 1), -1 ), MACD(), 1 ) >= 0.90 * ValueWhen( Trough( LOW, 2, 1) != Ref( Trough( LOW, 2, 1), -1 ), MACD(), 2 ) AND MACD() < 0;
  64.  
  65. temp2= Peak(  HIGH,2, 1) > 1.04 * Ref( Peak( HIGH, 2, 1), -1) AND ValueWhen( Peak( HIGH, 2, 1) != Ref( Peak( HIGH, 2, 1), -1 ), MACD(), 1 ) <= 0.90 * ValueWhen( Peak(  HIGH, 2, 1) != Ref( Peak(  HIGH, 2, 1), -1 ), MACD(), 2 ) AND MACD() > 0;
  66.  
  67. writeif( hhv( temp, 5 ) == 1,"A bullish divergence occurred " + writeval( barssince( temp ), 1.0 ) + 
  68. " period(s) ago. Wait for upward price movement for confirmation before considering any long positions.",
  69. writeif( hhv( temp2,5) == 1,
  70. "A bearish divergence occurred " +
  71. writeval( barssince( temp2 ), 1.0 ) +
  72. " period(s) ago.  Wait for downward price movement for confirmation before considering any short positions.",
  73. "There have been no divergence signals within the last 5 periods." ) );
  74.  
  75. "\n\nThis commentary is not a recommendation to buy or sell, but rather a guideline to interpreting the specified indicators.  This information should only be used by investors who are aware of the risk inherent in securities trading.  The author accepts no liability whatsoever for any loss arising from any use of this expert or its contents.";
  76.  
  77.